﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;
using MasterDetailTemplate.Views;

namespace MasterDetailTemplate.Services {
    /// <summary>
    /// 内容导航服务接口。
    /// By WZC
    /// </summary>
    public interface IContentNavigationService {
        /// <summary>
        /// 返回。
        /// </summary>
        Task GoBackAsync();

        /// <summary>
        /// 导航到页面。
        /// </summary>
        /// <param name="pageKey">页面键。</param>
        Task NavigateToAsync(string pageKey);

        /// <summary>
        /// 导航到页面。
        /// </summary>
        /// <param name="pageKey">页面键。</param>
        /// <param name="parameter">参数。</param>
        /// <returns></returns>
        Task NavigateToAsync(string pageKey, object parameter);
    }

    /// <summary>
    /// 内容导航常量。
    /// By WZC
    /// </summary>
    public static class ContentNavigationConstants {
        /// <summary>
        /// 添加事件页面。
        /// </summary>
        public const string AddEventPage = nameof(Views.AddEventPage);

        /// <summary>
        /// 纪念日页面。
        /// </summary>
        public const string AnniversaryPage = nameof(Views.AnniversaryPage);

        /// <summary>
        /// 纪念日详情页。
        /// </summary>
        public const string AnniversaryDetailPage =
            nameof(Views.AnniversaryDetailPage);

        /// <summary>
        /// 纪念日修改页。
        /// </summary>
        public const string AnniversaryChangePage =
            nameof(Views.AnniversaryChangePage);

        /// <summary>
        /// 纪念日详情页。
        /// </summary>
        public const string AnniversarySearchPage =
            nameof(Views.AnniversarySearchPage);

        /// <summary>
        /// 搜索页面。
        /// </summary>
        public const string SearchPage = nameof(Views.SearchPage);

        /// <summary>
        /// 页面键-页面类型字典（反射）
        /// </summary>
        public static readonly Dictionary<string, Type> PageKeyTypeDictionary =
            new Dictionary<string, Type>
            {
                {AddEventPage, typeof(AddEventPage)},
                {AnniversaryPage, typeof(AnniversaryPage)},
                {AnniversaryDetailPage,typeof(AnniversaryDetailPage)},
                {AnniversaryChangePage, typeof(AnniversaryChangePage)},
                {AnniversarySearchPage, typeof(AnniversarySearchPage)},
                {SearchPage, typeof(SearchPage)}
            };
    }
}